<template>
	<div class="content">
		<div class="base" style="margin-bottom: 12px;">
			<Form inline class="fl">
				<Input type="text" placeholder="请输入用户ID" class="w200 m-r10" v-model="userID" />
				<Select placeholder="请选等级" class="w200 m-r10" v-model="state2">
					<Option value="0">全部</Option>
					<Option value="1">普通会员</Option>
					<Option value="2">VIP节点</Option>
					<Option value="3">超级节点</Option>
				</Select>
				<DatePicker type="daterange" split-panels placeholder="请选择时间" class="w200 m-r10" format="yyyy-MM-dd" @on-change="getTime"></DatePicker>
				<Button type="primary" @click="query">查询</Button>
			</Form>
		</div>
		<Button class="daochu" type="primary" size="large" @click="exportData" :loading="dcShow">
      		<Icon type="ios-download-outline"></Icon>导出
    	</Button>
		<Table stripe :columns="columns1" :data="list" ref="table" :loading="loading"></Table>
		<!--<Table stripe :columns="columns1" :data="downList" ref="table2" v-show="false"></Table>-->

		<Page :total="info" show-elevator :page-size="pageSize" show-total @on-change="changepage" :current.sync="current"></Page>

		<Modal v-model="modal2" title="Ta的节点" width="50%">
			<Form :label-width="100">
				<div class="base p-b10 bor-b">
					<Form inline class="fl">
						<Input type="text" placeholder="请输入用户ID" class="w200 m-r10" v-model="upUserID" />
						<!-- <Input type="text" placeholder="请输入用户名" class="w200 m-r10" v-model="upPhone" /> -->
						<Select placeholder="请选择等级" class="w200 m-r10" v-model="state3">
							<Option value="0">全部</Option>
							<Option value="1">普通会员</Option>
							<Option value="2">VIP节点</Option>
							<Option value="3">超级节点</Option>
						</Select>
						<DatePicker type="daterange" split-panels placeholder="请选择注册时间" class="w200 m-r10" format="yyyy-MM-dd" @on-change="getTime1" v-model="dataPicker"></DatePicker>
						<Button type="primary" @click="jidian">查询</Button>
					</Form>
				</div>
				<Table height="400" class="m-t10" stripe :columns="columns2" :data="jdList" :loading="loading2"></Table>
				<Page :total="info2" show-elevator :page-size="pageSize2" show-total @on-change="changepage2" :current.sync="current2" ref="page2"></Page>
			</Form>
		</Modal>

		<Modal v-model="modal3" title="Ta的上级" width="50%">
			<Table height="200" class="m-t10" stripe :columns="columns9" :data="myUpList"></Table>
		</Modal>

		<Modal v-model="modal6" title="团队人数" width="50%" @on-cancel="teamList = [];">
			<Table height="200" class="m-t10" stripe :columns="columns10" :data="teamList" :loading="teamLoading"></Table>
		</Modal>

		<Modal v-model="modal4" title="账户流水" width="40%">
			<fieldset style="margin-bottom: 10px;">
				<legend>账户信息</legend>
				<div>
					<table>
						<tbody>
							<tr>
								<!-- <td class="padding">
									钱包账户：
									<span class="blue" v-text="Fixed(flow.wallet)"></span>
								</td>
								<td class="padding">
									币币账户：
									<span class="blue" v-text="Fixed(flow.coin)"></span>
								</td> -->
								<td class="padding">
									可用账户：
									<span class="blue" v-text="Fixed(flow.available)"></span>
								</td>
								<td class="padding">
									锁仓账户：
									<span class="blue" v-text="Fixed(flow.freeze)"></span>
								</td>
								<!-- <td class="padding">
									OTC账户：
									<span class="blue" v-text="Fixed(flow.otc)"></span>
								</td> -->
							</tr>
						</tbody>
					</table>
				</div>
			</fieldset>
			<Tabs type="card" class="m-t10" v-model="tabsKey" @on-click="liushui(tabsKey,1)">
				<TabPane label="可用账户" name="1">
					<Table height="400" stripe :columns="columns3" :data="contributions" ref="table3" :loading="loading3"></Table>
					<Page :total="info3" show-elevator :page-size="pageSize2" show-total @on-change="changepage3" :current.sync="current3" ref="page3"></Page>
				</TabPane>
				<TabPane label="锁仓账户" name="2">
					<Table height="400" stripe :columns="columns3" :data="contributions2" ref="table4" :loading="loading4"></Table>
					<Page :total="info4" show-elevator :page-size="pageSize2" show-total @on-change="changepage3" :current.sync="current4" ref="page4"></Page>
				</TabPane>
				<!-- <TabPane label="挖矿账户" name="4">
					<Table height="400" stripe :columns="columns3" :data="contributions3" ref="table5" :loading="loading5"></Table>
					<Page :total="info5" show-elevator :page-size="pageSize2" show-total @on-change="changepage3" :current.sync="current5" ref="page5"></Page>
				</TabPane>
				<TabPane label="OTC账户" name="3">
					<Table height="400" stripe :columns="columns3" :data="contributions4" ref="table6" :loading="loading6"></Table>
					<Page :total="info6" show-elevator :page-size="pageSize2" show-total @on-change="changepage3" :current.sync="current6" ref="page6"></Page>
				</TabPane> -->
			</Tabs>
		</Modal>
		<Modal v-model="modal1" title="用户充值" width="40%" :mask-closable="false">
			<Form :label-width="100" :model="addForm" :rules="rules" ref="refuse">
				<FormItem label="充值用户UUID" >
					<Input class="w-50" v-model="addForm.userId" placeholder="请输入充值会员ID" :disabled="true" />
				</FormItem>
				<FormItem label="充值用户账号" >
					<Input class="w-50" v-model="addForm.userName" placeholder="#" :disabled="true" />
				</FormItem>
				<FormItem label="账户类型" >
					<Select placeholder="请选择账户类型" class="w200 m-r10" v-model="addForm.UpgradeState">
						<Option value="1">可用</Option>
						<Option value="2">锁仓</Option>
					</Select>
				</FormItem>
				<FormItem label="充值数量" >
					<Input class="w-50" v-model="addForm.userNum" placeholder="请输入充值数量" />
				</FormItem>
				<FormItem label="放大倍数" >
					<Input class="w-50" v-model="addForm.enlarge" placeholder="请输入放大倍数" />
				</FormItem>
				<FormItem label="备注" >
					<Input class="w-50" v-model="addForm.userRem" placeholder="请输入备注" />
				</FormItem>
				<FormItem label="充值密码" >
					<Input class="w-50" v-model="addForm.password" placeholder="请输入充值密码" type="password" />
				</FormItem>
				<FormItem label >
					<span class="red m-l10">*请认真检查充值会员信息和充值数量</span>
				</FormItem>
			</Form>
			<div slot="footer">
				<Button type="text" size="large" @click="closejj">取消</Button>
				<Button type="primary" size="large" @click="addjj">确定</Button>
			</div>
		</Modal>
		<Modal v-model="modal_Upgrade" title="升级" width="40%" :mask-closable="false">
			<Form :label-width="100" :model="addForm" :rules="rules" ref="refuse">
				<FormItem label="用户ID" prop="title">
					<Input class="w-50" v-model="UpgradeUid" placeholder="请输入充值会员ID" :disabled="true" />
				</FormItem>
				<FormItem label="用户名" prop="title">
					<Input class="w-50" v-model="UpgradeName" placeholder="#" :disabled="true" />
				</FormItem>
				<FormItem label="当前会员等级" prop="title">
					<Input class="w-50" v-model="UpgradeLevel" placeholder="#" :disabled="true" />
				</FormItem>
				<FormItem label="会员等级" prop="UpgradeState">
					<Select placeholder="请选择等级" class="w200 m-r10" v-model="UpgradeState">
						<Option value="1" :disabled="1 <= this.level">普通会员</Option>
						<Option value="2" :disabled="2 <= this.level">VIP节点</Option>
						<Option value="3" :disabled="3 <= this.level">超级节点</Option>
					</Select>
				</FormItem>
			</Form>
			<div slot="footer">
				<Button type="text" size="large" @click="UpgradeClose">取消</Button>
				<Button type="primary" size="large" @click="UpgradeAdd">确定</Button>
			</div>
		</Modal>
		<Modal v-model="complaintModal" title="被投诉记录" width="70%">
			<fieldset style="margin-bottom: 10px;">
				<legend>账户信息</legend>
				<div>
					<table>
						<tbody>
							<tr>
								<td class="padding">
									累计投诉次数：
									<span class="blue" v-text="complaintCount">0</span>
								</td>
							</tr>
						</tbody>
					</table>
				</div>
			</fieldset>
			<Table height="400" stripe :columns="complaintColumns" :data="complaintList" ref="table7" :loading="loading7"></Table>
			<Page :total="info7" show-elevator :page-size="pageSize2" show-total @on-change="complaintPageChange" :current.sync="current4" ref="page7"></Page>
		</Modal>
	</div>
</template>
<script>
	import moment from "moment";
	let _this;
	export default {
		data() {
			return {
				dataPicker: '',
				loading: true,
				loading2: true,
				loading3: true,
				loading4: true,
				loading5: true,
				loading6: true,
				loading7: true,
				teamLoading: true,
				Upgradeid:'',
				UpgradeUid:'',
				UpgradeName:'',
				UpgradeState:'',
				UpgradeLevel:'',
				lsType: 1, //流水的type
				dcShow: false,
				jsonData: [],
				complaintList: [], //投诉记录列表
				modal1: false,
				lsId: '', //账户流水Id
				tabsKey: '1',
				upPhone: '',
				addForm: {
					userId: "",
					userName: "",
					userNum: "",
					userRem: "",
					id: "",
					password: "",
					UpgradeState:0,
					enlarge:''
				},
				rules: {
					userNum: [{
							required: true,
							message: "充值USDT不能为空",
							trigger: "blur"
						},
						{
							type: "string",
							pattern: /^(([1-9]\d{0,9})|0)(\.\d{0,9})?$/,
							message: "请输入合法的充值USDT数量",
							trigger: "blur"
						}
					],
					userRem: [{
						required: true,
						message: "备注不能为空",
						trigger: "blur"
					}],
					password: [{
						required: true,
						message: "充值密码不能为空",
						trigger: "blur"
					}]
				},
				level:'',
				state: "", // 状态
				state2: "", // 状态
				state3: "",
				model: false,
				loading: true,
				modelIndex: "",
				userID: "",
				trueName: "",
				list: [], // 会员列表
				downList: [],
				zcList: [], // 资产列表
				jdList: [], // 节点列表
				myUpList: [], // 上级的信息
				teamList: [], //团队人数
				liushuiSum: {
					gold: "",
					mine1: "",
					mine2: "",
					mine3: ""
				},
				flow: {
					available: '0.00',
					coin: '0.00',
					freeze: '0.00',
					otc: '0.00',
					wallet: '0.00',
				},
				contributions: [],
				contributions2: [],
				contributions3: [],
				contributions4: [],
				consumeMINE: [], // 消费明细
				exchangeMINE: [], // 兑换明细
				gold: [], //GOLD明细
				releasedMINE: [], //待释放明细
				huiyId: "",
				info: null, // 总条数
				info2: null, // 总条数
				info3: null, // 总条数
				info4: null, // 总条数
				info5: null, // 总条数
				info6: null, // 总条数
				info7: null, // 总条数
				pageSize: 20, // 一页显示多少条
				pageSize2: 10, // 一页显示多少条
				page: 1, // 页数
				page2: 1, // 页数
				page3: 1, // 页数
				page4: 1, // 页数
				page5: 1, // 页数
				page6: 1, // 页数
				page7: 1, // 页数
				current: 1,
				current2: 1,
				current3: 1,
				current4: 1,
				current5: 1,
				current6: 1,
				current7: 1,
				DownloadList: [], //导出table
				upUserID: "",
				paiid: "",
				dataValue: ['', ''], // 时间段值 会员列表
				dataValue1: ['', ''], // 时间段值  节点
				phone: "",
				modal2: false,
				modal3: false,
				modal4: false,
				modal5: false,
				modal6: false,
				modal_Upgrade:false,
				complaintModal: false,
				complaintId: '',
				complaintCount: '',
				columns1: [{
						title: "用户ID",
						key: "uuid",
						align: "center",
						render: (h, params) => {
							return h(
								"div", {
									style: {
										cursor: "pointer",
										color: "#2db7f5"
									},
									on: {
										click: () => {
											this.getUuid(params.row.id);
										}
									}
								},
								params.row.uuid
							);
						}
					},
					{
						title: "用户名",
						align: "center",
						key: "userName",
						render: (h, params) => {
							return h("div", params.row.userName == null ? "#" : params.row.userName);
						}
					},
					{
						title: "等级",
						align: "center",
						key: "levelId",
						render: (h, params) => {
							return h("div", params.row.levelId == 1 ? "普通会员" : params.row.levelId == 2 ? "VIP节点" : params.row.levelId == 3 ? "超级节点" : "系统用户");
						}
					},
					
					{
						title: "Ta的节点",
						align: "center",
						key: "nodesNum",
						render: (h, params) => {
							return h(
								"div", {
									style: {
										cursor: "pointer",
										color: "#2db7f5"
									},
									on: {
										click: () => {
											this.zhitui(params.row.id);
											this.upUserID = "";
											this.upPhone = "";
											this.state3 = "";
											this.dataPicker = '';
										}
									}
								},
								params.row.nodesNum
							);
						}
					},
					
					{
						title: "注册时间",
						align: "center",
						key: "createTime",
						width: 150,
						sortable: true,
						render: (h, params) => {
							return h("div", params.row.createTime == null ? "#" : this.stringToTime(params.row.createTime));
						}
					},
					{
						title: "账号状态",
						align: "center",
						key: "status",
						render: (h, params) => {
							return h("div", [
								h(
									"Button", {
										props: {
											type: params.row.status == "冻结" ? "error" : 'primary',
											size: "small"
										},
										style: {
											marginRight: "5px"
										},
										on: {
											click: () => {
												this.userStatus(params.row.id, params.row.status == "冻结" ? 2 : 1);
											}
										}
									},
									params.row.status
								)
							]);
						}
					},
					{
						title: "操作",
						key: "action",
						width: 280,
						fixed: "right",
						align: "center",
						render: (h, params) => {
							return h("div", [
								h(
									"Button", {
										props: {
											type: "primary",
											size: "small",
											disabled: params.row.status == "冻结" ? false : true
										},
										style: {
											marginRight: "5px"
										},
										on: {
											click: () => {
												this.Recharge(params.row.uuid, params.row.id, params.row.userName);
											}
										}
									},
									"充值"
								),
								h(
									"Button", {
										props: {
											type: "primary",
											size: "small",
											disabled: params.row.levelId != 3 ? false : true
										},
										style: {
											marginRight: "5px"
										},
										on: {
											click: () => {
												this.Upgrade(params.row.id,params.row.uuid,params.row.userName,params.row.levelId);
												this.modal_Upgrade = true;
											}
										}
									},
									"升级"
								),
								h(
									"Button", {
										props: {
											type: "primary",
											size: "small"
										},
										style: {
											marginRight: "5px"
										},
										on: {
											click: () => {
												this.lsId = params.row.id;
												this.tabsKey = '1';
												this.liushui(1, 1);
											}
										}
									},
									"账户流水"
								),
								// h(
								// 	"Button", {
								// 		props: {
								// 			type: "primary",
								// 			size: "small",
								// 		},
								// 		style: {
								// 			marginRight: "5px"
								// 		},
								// 		on: {
								// 			click: () => {
								// 				this.complaintModal = true;
								// 				this.loading7 = true;
								// 				this.axios.post('/admin/otc/getUserAppealedRecord', this.qs.stringify({
								// 					size: this.pageSize2,
								// 					current: this.page7,
								// 					userId: params.row.id
								// 				})).then(res => {
								// 					if(res.data.code == 200) {
								// 						this.complaintList = res.data.data.records;
								// 						this.info7 = res.data.data.total;
								// 						this.complaintId = params.row.id;
								// 						this.loading7 = false;
								// 						this.complaintCount = res.data.data.total;
								// 					}
								// 				})
								// 			}
								// 		}
								// 	},
								// 	"被投诉记录"
								// ),
							]);
						}
					}
				],
				columns2: [{
						title: "用户ID",
						align: "center",
						key: "uuid",
						render: (h, params) => {
							return h("div", params.row.uuid == null ? "#" : params.row.uuid);
						}
					},
					{
						title: "用户名",
						align: "center",
						key: "userName",
						render: (h, params) => {
							return h(
								"div",
								params.row.userName == null ? "#" : params.row.userName
							);
						}
					},
					{
						title: "等级",
						align: "center",
						key: "levelId",
						render: (h, params) => {
							return h("div", params.row.levelId == 1 ? "普通会员" : params.row.levelId == 2 ? "VIP节点" : params.row.levelId == 3 ? "超级节点" : "系统用户");
						}
					},
					{
						title: "注册时间",
						align: "center",
						key: "createTime",
						sortable: true,
						render: (h, params) => {
							return h("div", params.row.createTime == null ? "#" : this.stringToTime(params.row.createTime));
						}
					}
				],
				//账户流水列表字段
				columns3: [{
						title: "时间",
						align: "center",
						key: "dateTime",
						sortable: true,
						render: (h, params) => {
							return h("div", params.row.dateTime == null ? "#" : this.stringToTime(params.row.dateTime));
						}
					},
					{
						title: "数量",
						align: "center",
						key: "num",
						render: (h, params) => {
							return h("div", params.row.num == null ? "#" : params.row.num);
						}
					},
					{
						title: "类型",
						align: "center",
						key: "type",
						render: (h, params) => {
							return h("div", params.row.type == null ? "#" : params.row.type);
						}
					}
				],
				//Ta的上级列表字段
				columns9: [{
						title: "用户ID",
						align: "center",
						key: "uuid",
						render: (h, params) => {
							return h("div", params.row.uuid == null ? "#" : params.row.uuid);
						}
					},
					{
						title: "用户名",
						align: "center",
						key: "userName",
						render: (h, params) => {
							return h("div", params.row.userName == null ? "#" : params.row.userName);
						}
					},
					{
						title: "等级",
						align: "center",
						key: "levelId",
						render: (h, params) => {
							return h("div", params.row.levelId == 1 ? "普通会员" : params.row.levelId == 2 ? "VIP节点" : params.row.levelId == 3 ? "超级节点" : "系统用户");
						}
					},
					{
						title: "注册时间",
						align: "center",
						key: "createTime",
						sortable: true,
						render: (h, params) => {
							return h("div", params.row.createTime == null ? "#" : this.stringToTime(params.row.createTime));
						}
					}
				],
				//团队人数字段
				columns10: [{
						title: "个人UUID",
						align: "center",
						key: "uuid",
						render: (h, params) => {
							return h("div", params.row.uuid == null ? "#" : params.row.uuid);
						}
					},
					{
						title: "手机号码",
						align: "center",
						key: "userName",
						render: (h, params) => {
							return h("div", params.row.userName == null ? "#" : params.row.userName);
						}
					},
					{
						title: "等级",
						align: "center",
						key: "levelId",
						render: (h, params) => {
							return h("div", params.row.levelId == null ? "#" : params.row.levelId == 1 ? '实名用户' : params.row.levelId == 2 ? '普通用户' : params.row.levelId == 3 ? '一星节点' : params.row.levelId == 4 ? '二星节点' : params.row.levelId == 5 ? '三星节点' : params.row.levelId == 6 ? '四星节点' : params.row.levelId == 7 ? '社区节点' : params.row.levelId == 8 ? '超级节点' : "#");
						}
					},
					{
						title: "有效用户",
						align: "center",
						key: "validMember",
						render: (h, params) => {
							return h("div", params.row.validMember == null ? "#" : params.row.validMember == '1' ? '是' : '不是');
						}
					},
					{
						title: "代数",
						align: "center",
						key: "teamLayer",
						render: (h, params) => {
							return h("div", params.row.teamLayer == null ? "#" : params.row.teamLayer);
						}
					},
					{
						title: "认证状态",
						align: "center",
						key: "allowPlanId",
						render: (h, params) => {
							return h("div", params.row.idcardVerifyStatus == null ? "#" : params.row.idcardVerifyStatus == 0 ? '未提交' : params.row.idcardVerifyStatus == 1 ? '已审核' : params.row.idcardVerifyStatus == 2 ? '驳回' : params.row.idcardVerifyStatus == 3 ? '已提交未审核' : '#');
						}
					},
					{
						title: "注册时间",
						align: "center",
						key: "createTime",
						sortable: true,
						render: (h, params) => {
							return h("div", params.row.createTime == null ? "#" : this.stringToTime(params.row.createTime));
						}
					}
				],
				complaintColumns: [{
					title: '申诉方',
					key: 'createMemberId',
					render: (h, params) => {
						return h('div', params.row.createMemberId == null ? '#' : params.row.createMemberId == params.row.memberId ? '用户' : '商户')
					}
				}, {
					title: '商户名',
					key: 'otcUserName',
					render: (h, params) => {
						return h('div', params.row.otcUserName == null ? '#' : params.row.otcUserName)
					}
				}, {
					title: '用户名',
					key: 'userName',
					render: (h, params) => {
						return h('div', params.row.userName == null ? '#' : params.row.userName)
					}
				}, {
					title: '凭证',
					key: 'credentials',
					render: (h, params) => {
						return h('div', [
							h('img', {
								attrs: {
									src: params.row.credentials,
									preview: '1'
								},
								style: {
									width: '70px',
									height: '70px',
									margin: '10px 0'
								}
							})
						])
					}
				}, {
					title: '申诉备注',
					key: 'appealRemark',
					render: (h, params) => {
						return h('div', params.row.appealRemark == null ? '#' : params.row.appealRemark)
					}
				}, {
					title: '处理结果备注',
					key: 'resultsRemark',
					render: (h, params) => {
						return h('div', params.row.resultsRemark == null ? '#' : params.row.resultsRemark)
					}
				},
				 {
					title: '处理结果',
					key: 'processingResults',
					render: (h, params) => {
						return h('div', params.row.processingResults == null ? '#' : params.row.processingResults == 0 ? '未处理' : '已处理');
					}
				}
				]
			};
		},
		beforeCreate() {
			_this = this;
		},
		methods: {
			getUuid(id) {
				// 点击用户,查询上级的信息
				this.myUpList = [];
				this.modal3 = true;
				this.axios.get("/admin/account/member/getSuperior", {
					params: {
						userId: id
					}
				}).then(res => {
					if(res.data.code == 200) {
						this.myUpList = res.data.data;
					} else if(res.data.code == 500) {
						this.$Message.info(res.data.msg);
					}
				});
			},
			// 节点
			zhitui(id) {
				this.modal2 = true;
				this.$refs['page2'].currentPage = 1;
				this.paiid = id;
				this.axios.post("/admin/account/member/getChildNodes", this.qs.stringify({
					current: 1,
					size: this.pageSize2,
					id: id,
				})).then(res => {
					if(res.data.code == 200) {
						this.jdList = res.data.data.records;
						this.info2 = res.data.data.total;
						this.loading2 = false;
					} else if(res.data.code == 500) {
						this.$Message.info(res.data.msg);
					}
				});
			},
			jidian() {
				this.axios.post("/admin/account/member/getChildNodes", this.qs.stringify({
					current: this.page2,
					size: this.pageSize2,
					startTime: this.dataValue1[0] == "" ? "" : this.dataValue1[0] + ' 00:00:00',
					endTime: this.dataValue1[1] == "" ? "" : this.dataValue1[1] + ' 23:59:59',
					id: this.paiid,
					uuid: this.upUserID,
					userName: this.upPhone,
					levelId: this.state3 == 0 ? '' : this.state3
				})).then(res => {
					if(res.data.code == 200) {
						this.jdList = res.data.data.records;
						this.info2 = res.data.data.total;
						this.loading2 = false;
					} else if(res.data.code == 500) {
						this.$Message.info(res.data.msg);
						this.jdList = [];
					}
				});
			},
			// 查看流水
			liushui(type, current) {
				this.modal4 = true;
				this.getUser(type, current);
				this.$refs['page3'].currentPage = 1;
				this.$refs['page4'].currentPage = 1;
				this.$refs['page5'].currentPage = 1;
				this.$refs['page6'].currentPage = 1;
			},
			// 获取账户流水
			getUser(type, current) {
				this.loading3 = true;
				this.loading4 = true;
				this.loading5 = true;
				this.loading6 = true;
				type = Number(type);
				this.lsType = type;
				this.axios.post("/admin/account/member/statistical/getAccountDetail", this.qs.stringify({
					id: this.lsId,
					size: this.pageSize2,
					current: current,
					paymentType: type //1 可用账户 2 锁仓账户 
				})).then(res => {
					if(res.data.code == 200) {
						this.flow = res.data.data.Balance;
						switch(type) {
							case 1:
								this.contributions = res.data.data.list.records;
								this.info3 = res.data.data.list.total;
								this.loading3 = false;
								break;
							case 2:
								this.contributions2 = res.data.data.list.records;
								this.info4 = res.data.data.list.total;
								this.loading4 = false;
								break;
							case 3:
								this.contributions4 = res.data.data.list.records;
								this.info6 = res.data.data.list.total;
								this.loading6 = false;
								break;
							case 4:
								this.contributions3 = res.data.data.list.records;
								this.info5 = res.data.data.list.total;
								this.loading5 = false;
								break;
						}

					} else if(res.data.code == 500) {
						this.$Message.info(res.data.msg);
					}
				});
			},
			// 升级
			Upgrade(id,uuid,userName,level){
				// alert(id+','+uuid+','+userName)
				this.UpgradeId = id;
				this.UpgradeUid = uuid;
				this.UpgradeName = userName;
				this.level = level;
				switch(level)
				{
					case 1:
					this.UpgradeLevel = '普通会员';
					break;
					case 2:
					this.UpgradeLevel = 'VIP节点';
					break;
					case 3:
					this.UpgradeLevel = '超级节点';
					break;
				}
			},
			UpgradeAdd(){
				if(this.UpgradeState == ''){
					this.$Message.info('请选择会员等级');
				}
				let params = this.qs.stringify({
					userId: this.UpgradeId,
					level: this.UpgradeState
				});

				this.axios.post("/admin/account/member/levelUser",params).then(res => {
					if(res.data.code == 200) {
						this.modal_Upgrade = false
						this.UpgradeState = '';
						this.getList();
						this.$Message.info(res.data.msg);
					}else{
					}
					
				});
			},
			UpgradeClose(){
				this.modal_Upgrade = false;
				this.UpgradeState = '';
			},
			// 导出
			exportData() {
				let params = this.qs.stringify({
					current: this.page,
					size: this.pageSize
				});
				this.jsonData = [];
				this.dcShow = true;
				this.axios.post("/admin/account/member/getAllUser", this.qs.stringify({
					current: this.page,
					size: this.pageSize,
					uuid: this.userID,
					phone: this.phone,
					trueName: this.trueName,
					status: this.state2 == 0 ? "" : this.state2,
					levelId: this.state != 0 ? this.state : "",
					startTime: this.dataValue[0] == "" ? "" : this.dataValue[0] + ' 00:00:00',
					endTime: this.dataValue[1] == "" ? "" : this.dataValue[1] + ' 23:59:59'
				})).then(res => {
					if(res.data.code == 200) {
						this.axios.post("/admin/account/member/getAllUser", this.qs.stringify({
							current: this.page,
							size: res.data.data.total,
							uuid: this.userID,
							phone: this.phone,
							trueName: this.trueName,
							status: this.state2 == 0 ? "" : this.state2,
							levelId: this.state != 0 ? this.state : "",
							startTime: this.dataValue[0] == "" ? "" : this.dataValue[0] + ' 00:00:00',
							endTime: this.dataValue[1] == "" ? "" : this.dataValue[1] + ' 23:59:59'
						})).then(res => {
							if(res.data.code == 200) {
								this.downList = res.data.data.records;
								this.downList.forEach((row, index) => {
									// this.downList[index].levelId = this.downList[index].levelId == 1 ? "实名用户" : this.downList[index].levelId == 2 ? "普通用户" : this.downList[index].levelId == 3 ? "一星节点" : this.downList[index].levelId == 4 ? "二星节点" : this.downList[index].levelId == 5 ? "三星节点" : this.downList[index].levelId == 6 ? "四星节点" : this.downList[index].levelId == 7 ? "社区节点" : this.downList[index].levelId == 8 ? "超级节点" : "#";
									this.downList[index].levelId = this.downList[index].levelId == 1 ? "普通会员" : this.downList[index].levelId == 2 ? "VIP节点" : this.downList[index].levelId == 3 ? "超级节点" : "系统用户";
									this.downList[index].status = this.downList[index].status == 1 ? "正常" : this.downList[index].status == 2 ? "冻结" : "#";
									this.downList[index].validMember = this.downList[index].validMember == '1' ? "是" : this.downList[index].validMember == '0' ? "不是" : "#";

									this.downList[index].uuid = this.downList[index].uuid == null ? '#' : this.downList[index].uuid;
									this.downList[index].userName = this.downList[index].userName == null ? '#' : this.downList[index].userName;
									this.downList[index].trueName = this.downList[index].trueName == null ? '#' : this.downList[index].trueName;
									this.downList[index].idCard = this.downList[index].idCard == null ? '#' : this.downList[index].idCard;
									this.downList[index].walletBalance = this.downList[index].walletBalance == null ? '#' : this.Fixed(this.downList[index].walletBalance);
									this.downList[index].currencyBalance = this.downList[index].currencyBalance == null ? '#' : this.Fixed(this.downList[index].currencyBalance);
									this.downList[index].otcbalance = this.downList[index].otcbalance == null ? '#' : this.Fixed(this.downList[index].otcbalance);
									this.downList[index].availableNum = this.downList[index].availableNum == null ? '#' : this.Fixed(this.downList[index].availableNum);
									this.downList[index].freezeNum = this.downList[index].freezeNum == null ? '#' : this.Fixed(this.downList[index].freezeNum);
									this.downList[index].nodesNum = this.downList[index].nodesNum == null ? '#' : this.downList[index].nodesNum;
									this.downList[index].number = this.downList[index].nodesNum == null ? '#' : this.downList[index].number;
									this.downList[index].createTime = this.downList[index].freezeNum == null ? '#' : this.downList[index].createTime;
									this.jsonData.push({
										// uuid: this.downList[index].uuid,
										// userName: this.downList[index].userName,
										// trueName: this.downList[index].trueName,
										// idCard: this.downList[index].idCard,
										// levelId: this.downList[index].levelId,
										// validMember: this.downList[index].validMember,
										// walletBalance: this.downList[index].walletBalance,
										// currencyBalance: this.downList[index].currencyBalance,
										// otcbalance: this.downList[index].otcbalance,
										// availableNum: this.downList[index].availableNum,
										// freezeNum: this.downList[index].freezeNum,
										// nodesNum: this.downList[index].nodesNum,
										// number: this.downList[index].number,
										// createTime: this.downList[index].createTime,
										// status: this.downList[index].status
										uuid: this.downList[index].uuid,
										userName: this.downList[index].userName,
										levelId: this.downList[index].levelId,
										nodesNum: this.downList[index].nodesNum,
										createTime: this.downList[index].createTime,
									});
								});
								let str = `用户ID,用户名,等级,Ta的节点,注册时间,账号状态\n`;
								this.downLoad(this.jsonData, str, '会员列表');
							}
						});
					}
				});
			},
			// // 处理时间段时间格式
			getTime(daterange) {
				this.dataValue = daterange;
			},
			getTime1(daterange) {
				this.dataValue1 = daterange;
			},
			// 获取所有会员列表
			getList() {
				this.axios.post("/admin/account/member/getAllUser",
					this.qs.stringify({
						current: this.page,
						size: this.pageSize,
						uuid: this.userID,
						phone: this.phone,
						trueName: this.trueName,
						status: this.state2 == 0 ? "" : this.state2,
						levelId: this.state2 == 0 ? "" : this.state2,
						startTime: this.dataValue[0] == "" ? "" : this.dataValue[0] + ' 00:00:00',
						endTime: this.dataValue[1] == "" ? "" : this.dataValue[1] + ' 23:59:59'
					})
				).then(res => {
					if(res.data.code == 200) {
						this.list = res.data.data.records;
						this.list.forEach((row, index) => {
							// this.list[index].levelId = row.levelId == 1 ? "实名用户" : row.levelId == 2 ? "普通用户" : row.levelId == 3 ? "一星节点" : row.levelId == 4 ? "二星节点" : row.levelId == 5 ? "三星节点" : row.levelId == 6 ? "四星节点" : row.levelId == 7 ? "社区节点" : row.levelId == 8 ? "超级节点" : "#";
							this.list[index].status = row.status == 1 ? "冻结" : row.status == 2 ? "解冻" : "#";
						});
						this.info = res.data.data.total;
					}
					this.loading = false;
				});
			},
			// 查询
			query() {
				this.loading = true;
				let spy;
				this.current = 1;
				this.page = 1;
				this.axios.post("/admin/account/member/getAllUser", this.qs.stringify({
					current: this.page,
					size: this.pageSize,
					uuid: this.userID,
					phone: this.phone,
					trueName: this.trueName,
					status: this.state2 == 0 ? "" : this.state2,
					levelId: this.state2,
					startTime: this.dataValue[0] == "" ? "" : this.dataValue[0] + ' 00:00:00',
					endTime: this.dataValue[1] == "" ? "" : this.dataValue[1] + ' 23:59:59'
				})).then(res => {
					if(res.data.code == 200) {
						this.list = res.data.data.records;
						this.list.forEach((row, index) => {
							
							this.list[index].status = row.status == 1 ? "冻结" : row.status == 2 ? "解冻" : "#";
						});
						this.info = res.data.data.total;
						this.current = 1;
					} else if(res.data.code == 500) {
						this.$Message.info(res.data.msg);
						this.list = [];
						this.info = this.list.length;
					}
					this.loading = false;
				});
			},
			userStatus(id, statusId) {
				let _this = this;
				let statusText = "";

				if(statusId == "2") {
					statusText = "冻结";
				} else {
					statusText = "解冻";
				}

				this.$Modal.confirm({
					title: statusText + "账号",
					content: "是否要" + statusText + "该用户",
					onOk: function() {
						let params = this.qs.stringify({
							userId: id,
							status: statusId
						});
						_this.axios.post("/admin/account/member/freezeOrUnFreezeUser", params).then(res => {
							if(res.data.code == 200) {
								_this.$Message.info(res.data.msg);
								_this.getList();
							} else if(res.data.code == 500) {
								_this.$Message.info(res.data.msg);
							}
						});
					}
				});
			},
			// 分页
			changepage(page) {
				this.loading = true;
				this.page = page;
				this.axios.post("/admin/account/member/getAllUser", this.qs.stringify({
					current: this.page,
					size: this.pageSize,
					uuid: this.userID,
					phone: this.phone,
					trueName: this.trueName,
					status: this.state2 == 0 ? "" : this.state2,
					levelId: this.state != 0 ? this.state : "",
					startTime: this.dataValue[0] == "" ? "" : this.dataValue[0] + ' 00:00:00',
					endTime: this.dataValue[1] == "" ? "" : this.dataValue[1] + ' 23:59:59'
				})).then(res => {
					if(res.data.code == 200) {
						this.list = res.data.data.records;
						this.list.forEach((row, index) => {
							this.list[index].status = row.status == 1 ? "冻结" : row.status == 2 ? "解冻" : "#";
							// this.list[index].levelId = row.levelId == 1 ? "实名用户" : row.levelId == 2 ? "普通用户" : row.levelId == 3 ? "一星节点" : row.levelId == 4 ? "二星节点" : row.levelId == 5 ? "三星节点" : row.levelId == 6 ? "四星节点" : row.levelId == 7 ? "社区节点" : row.levelId == 8 ? "超级节点" : "#";
						});
					}
					this.loading = false;
				});
			},
			// 分页
			changepage2(page) {
				this.loading2 = true;
				this.page2 = page;
				this.jidian();
			},
			// 分页
			changepage3(page) {
				this.getUser(this.lsType, page);
			},
			Recharge(uuid, id, userName) {
				this.$refs["refuse"].resetFields(); // 重置表单
				this.modal1 = true;
				this.addForm.userId = uuid;
				this.addForm.id = id;
				this.addForm.userName = userName;
			},
			addjj() {
				if(this.addForm.UpgradeState == ''){
					this.$Message.info('请选择账户类型');
					return;
				}
				if(this.addForm.userNum == ''){
					this.$Message.info('请输入充值数量');
					return;
				}
				if(this.addForm.enlarge == ''){
					this.$Message.info('请输入放大倍数');
					return;
				}
				if(this.addForm.password == ''){
					this.$Message.info('请输入密码');
					return;
				}

	
				let params = this.qs.stringify({
					memberId: this.addForm.id,
					num: this.addForm.userNum,
					coinId: this.addForm.UpgradeState,
					enlarge:this.addForm.enlarge,
					remark: this.addForm.userRem,
					rechargePass: this.addForm.password,
				});
				this.axios.post("/admin/account/member/rechargeAccount", params).then(res => {
					if(res.data.code == 200) {
						this.$Message.info(res.data.msg);
						this.getList();
						this.modal1 = false;
						this.addForm.UpgradeState = 0;
						this.addForm.userNum = "";
						this.addForm.enlarge = "";
						this.addForm.userRem = "";
						this.addForm.password = "";
					}
				});
					
			},
			closejj() {
				this.modal1 = false;
			},
			complaintPageChange(page) {
				this.loading7 = true;
				this.axios.post('/admin/otc/getUserAppealedRecord', this.qs.stringify({
					size: this.pageSize2,
					current: page,
					userId: this.complaintId
				})).then(res => {
					if(res.data.code == 200) {
						this.complaintList = res.data.data.records;
						this.info7 = res.data.data.total;
						this.loading7 = false;
						this.complaintCount = res.data.data.total;
					}
				})
			}
		},
		created() {
			this.getList();
		},
		mounted() {
			this.$Message.config({
				top: 250
			});
		}
	};
</script>
<style lang="less">
	.caozuo {
		.ivu-modal-wrap {
			.ivu-modal {
				.ivu-modal-content {
					.ivu-modal-footer {
						padding: 12px 18px 12px 18px;
						.ivu-btn-text {
							float: left;
							padding-left: 70%;
						}
					}
				}
			}
		}
	}
	
	.w250 {
		width: 250px !important;
	}
	
	.demo-spin-container {
		display: inline-block;
		position: relative;
	}
</style>